﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BusinessLogicLayer
{
    public class clsCurrency
    {
        #region Properties
        public DateTime DateCreated { get; set; }
        public DateTime DateChanged { get; set; }
        public String UserCreated { get; set; }
        public String UserChanged { get; set; }
        public Int32 ID { get; set; }
        public String CurrencyName { get; set; }
        public String CurrencyAbbrevation { get; set; }
        public Double CurrencyValue { get; set; }
        public DateTime EffectiveFrom { get; set; }
        private ArrayList CurrencyValues { get; set; }
        #endregion

        #region Constructors
        #endregion

        #region Events
        #endregion

        #region Public Methods
        public override string ToString()
        {
            return this.CurrencyName;
        }

        /// <summary>
        /// Returns the value and the effective from date from the currency.
        /// </summary>
        /// <returns></returns>
        public String GetValueAsString()
        {
            return this.EffectiveFrom.ToString("dd.MM.yyyy") + " - " + this.CurrencyValue.ToString();
        }

        /// <summary>
        /// Adds a value to the currency.
        /// </summary>
        /// <param name="pCurrency"></param>
        public void SetCurrencyValue(clsCurrency pCurrency)
        {
            if (this.CurrencyValues == null)
            {
                this.CurrencyValues = new ArrayList();
            }
            this.CurrencyValues.Add(pCurrency);
        }

        /// <summary>
        /// Returns all the currency values.
        /// </summary>
        /// <returns></returns>
        public ArrayList GetCurrencyValues()
        {
            return this.CurrencyValues;
        }
        #endregion

        #region Private Methods
        #endregion
    }
}
